package 取硬币;

import java.util.Scanner;

public class Main {
    static int N = 100010, mol = (int) (1e9 + 7);
    static int[] f = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1 = in.nextInt();
        int n2 = in.nextInt();
        int m = in.nextInt();
        f[0] = 1;
        for (int i = 1; i <= n1; i++) {
            int v = in.nextInt();
            for (int j = v; j <= m; j++) {
                f[j] = (f[j] + f[j - v]) % mol;
            }
        }
        for (int i = 1; i <= n2; i++) {
            int v = in.nextInt();
            for (int j = m; j >= v; j--) {
                f[j] = (f[j] + f[j - v]) % mol;
            }
        }
        System.out.println(f[m]);
    }
}
